package com.zut.fitness.controller;


import com.zut.fitness.common.Result;
import com.zut.fitness.pojo.Commodity;
import com.zut.fitness.service.ICommodityService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;


import java.util.Date;
import java.util.List;

/**
 * 商品列表Controller
 *
 * @author yuanML2018
 * @date 2025-01-04
 */
@RestController
@RequestMapping("/commodity")
public class CommodityController
{
    @Autowired
    private ICommodityService commodityService;

    /**
     * 查询商品列表列表
     */

    @GetMapping("/list")
    public Result<List<Commodity>> list()
    {
        Commodity commodity = new Commodity();
        List<Commodity> list = commodityService.selectCommodityList(commodity);
        return Result.success(list);
    }


    /**
     * 获取商品列表详细信息
     */

    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id)
    {
        return Result.success(commodityService.selectCommodityById(id));
    }


}
